<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"
	contentType="text/html; charset=UTF-8"%>
<%@taglib prefix="s" uri="/struts-tags"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="pg" uri="http://jsptags.com/tags/navigation/pager"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<base href="<%=basePath%>">

		<title>合众人寿公益平台客户管理系统</title>

		<meta http-equiv="pragma" content="no-cache">
		<meta http-equiv="cache-control" content="no-cache">
		<meta http-equiv="expires" content="0">
		<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
		<meta http-equiv="description" content="This is my page">
		<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->

		<link href="<%=request.getContextPath()%>/html/css/Main.css"
			rel="stylesheet" type="text/css" />
		<script src="<%=request.getContextPath()%>/html/js/Calendar.js"
			charset="utf-8"></script>
			
			<style>
body,ul,ol,dl,dd,p,h1,h2,h3,h4,h5,h6,form,input,textarea,select,td,th{margin:0;padding:0; font-family:"宋体",Arial, Helvetica, sans-serif;}
li{ list-style:none;}
input{ background:none;}
.clear{ zoom:1;}
.clear:after{content:""; display:block; clear:both;}
td input{
width:200px;
}
td select{
width:200px;
}
</style>
			
		<SCRIPT type="text/javascript">
     function check(){
     	if(document.getElementById("memberName").value == ''){
     	   alert("请输入姓名!");
     	   return false;
     	}
     	if(document.getElementById("idCard").value == ''){
     	   alert("请输入身份证号!");
     	   return false;
     	}
     	if(document.getElementById("idCard").value != ''){
	     	if(! isIdCardNo(document.getElementById("idCard").value)){
	     	  return false;
	     	}
     	}
     	if(document.getElementById("gender").value == ''){
     	   alert("请输入性别!");
     	   return false;
     	}
     	if(document.getElementById("cellPhone").value == ''){
     	   alert("请输入手机号码!");
     	   return false;
     	}
     	if(!(/^1[3|4|5|8][0-9]\d{4,8}$/.test(document.getElementById("cellPhone").value))){ 
			alert("不是完整或者正确的手机号"); 
			document.getElementById("cellPhone").focus(); 
			return false; 
		} 
     	if(document.getElementById("subCompanyId").value == ''){
     	   alert("请选择分公司!");
     	   return false;
     	}
     	if(document.getElementById("subCityId").value == ''){
     	   alert("请选择中支机构!");
     	   return false;
     	}
     	if(document.getElementById("donateRecord").value == ''){
     	   alert("请输入捐赠记录!");
     	   return false;
     	}
     	var mail = document.getElementById("mail").value;
     	if(mail != ''){
	     	if(mail.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) == -1){
	     		alert("邮箱格式错误!");
	     		return false;
	     	}
     	}
     	if(document.getElementById("donateStuNum").value == ''){
     	   document.getElementById("donateStuNum").value = 0;
     	}
        document.getElementById("subComName").value = document.getElementById("subCompanyId").options[document.getElementById("subCompanyId").selectedIndex].innerText;
     	document.getElementById("subCityName").value = document.getElementById("subCityId").options[document.getElementById("subCityId").selectedIndex].innerText;     	
        
         return true;
     }
     
     
      function isIdCardNo(num)
        {
          var len = num.length, re; 
          if (isNaN(num.substring(0,len-1))) {alert("身份证输入的不是数字！"); return false;}
          if (len == 15)
            re = new RegExp(/^(\d{6})()?(\d{2})(\d{2})(\d{2})(\d{3})$/);
          else if (len == 18)
            re = new RegExp(/^(\d{6})()?(\d{4})(\d{2})(\d{2})(\d{3})(\d)$/);
          else {alert("身份证输入的数字位数不对！"); return false;}
          var a = num.match(re);
          if (a != null)
          {
            if (len==15)
            {
              var D = new Date("19"+a[3]+"/"+a[4]+"/"+a[5]);
              var B = D.getYear()==a[3]&&(D.getMonth()+1)==a[4]&&D.getDate()==a[5];
            }
            else
            {
              var D = new Date(a[3]+"/"+a[4]+"/"+a[5]);
              var B = D.getFullYear()==a[3]&&(D.getMonth()+1)==a[4]&&D.getDate()==a[5];
            }
            if (!B) {alert("输入的身份证号 "+ a[0] +" 里出生日期不对！"); return false;}
          }
          return true;
        }
	 </SCRIPT>
	</head>

	<body>
		<div class="container">
			<div class="wrap clear">
				<div class="sub_wp_right">
					<div class="rt_tt">
						<h3 class="tittle">
							<s:if test="memberEnjoyId == null || ''.equals(memberEnjoyId)">爱心之旅活动</s:if>
							<s:else>会员专项活动</s:else>/会员/修改会员信息
						</h3>
					</div>
					<div class="ct">
						<form
							action="<%=request.getContextPath()%>/subMember/updatedSubMember.do"
							method="post" onsubmit="return check()">
							<input type="hidden" name="journeyLoveId" value="${journeyLoveId}" >
							<input type="hidden" name="memberEnjoyId" value="${memberEnjoyId}" >
							<div class="add">
								<table  class="viewTable">
									<tr>
										<td align="right" class="title">
											<span>姓名<font color="red">(*)</font>：</span>
										</td>
										<td>
											<input type="text" name="subMember.sub_memberName" id="memberName"
												value="${subMember.sub_memberName }"/>
										</td>
										<td align="right" class="title">
											<span>性别<font color="red">(*)</font>：</span>
										</td>
										<td>
											<select name="subMember.sub_gender" id="gender">
												<option value="男"
													<c:if test="${subMember.sub_gender eq '男' }">selected</c:if>>
													男
												</option>
												<option value="女"
													<c:if test="${subMember.sub_gender eq '女' }">selected</c:if>>
													女
												</option>
											</select>
										</td>
									</tr>
									<tr>
										<td align="right" class="title">
											<span>身份证号<font color="red">(*)</font>：</span>
										</td>
										<td class="t2">
											<input type="text" name="subMember.sub_idCard"
												value="${subMember.sub_idCard }" id="idCard"/>
										</td>
										<td align="right" class="title">
											<span>出生日期：</span>
										</td>
										<td class="t2">
											<input type="text" name="subMember.sub_birthday" id="birdate"
												value="${subMember.sub_birthday}" onfocus="calendar()"/>
										</td>
									</tr>
									<tr>
										<td align="right" class="title">
											<span>手机号码<font color="red">(*)</font>：</span>
										</td>
										<td class="t2">
											<input type="text" name="subMember.sub_cellPhone" id="cellPhone"
												value="${subMember.sub_cellPhone }" />
										</td>
										<td align="right" class="title">
											<span>电子邮件：</span>
										</td>
										<td class="t2">
											<input type="text" name="subMember.sub_email"
												value="${subMember.sub_email }" id="mail"/>
										</td>
									</tr>
									<tr>
										<td align="right" class="title">
											<span>兴趣爱好：</span>
										</td>
										<td class="t2">
										     <input type="text" name="subMember.sub_carType" value="${subMember.sub_carType}"/>
										</td>
										<td align="right" class="title">
											<span>车辆品牌：</span>
										</td>
										<td class="t2">
											<input type="text" name="subMember.sub_carBrand"
												value="${subMember.sub_carBrand}" />
										</td>
										
									</tr>
									<tr>
										<td align="right" class="title">
											<span>捐助学生数：</span>
										</td>
										<td class="t2">
											<input type="text" name="subMember.sub_donateStuNum"
												id="donateStuNum" value="${subMember.sub_donateStuNum}" />
										</td>
										<td align="right" class="title">
											<span>分公司<font color="red">(*)</font>：</span>
										</td>
										<td class="t2">
											<select name="subMember.subCompany" id="subCompanyId"  style="width:200px;">
												<option value="${subMember.subCompany}" selected="selected">${subMember.subComName}</option> 
											</select>
										</td>
										 
									</tr>
									<tr>
									   <td align="right" class="title">
											<span>中支<font color="red">(*)</font>：</span>
										</td>
										<td class="t2" colspan="3">
											<select name="subMember.subCity" id="subCityId"  style="width:200px;">
												<option value="${subMember.subCity}" selected="selected" >${subMember.subCityName}</option>
											</select>
										</td>
									</tr>
									<tr>
										<td align="right" class="title">
											<span>捐赠记录<font color="red">(*)</font>：</span>
										</td>
										<td class="t2" colspan="3" >
											<textarea rows="5" cols="73" name="subMember.sub_donateRecord"
												id="donateRecord">${subMember.sub_donateRecord}</textarea>
										</td>
									</tr>
									<tr>
										<td align="right" class="title">
											<span>转介绍记录：</span>
										</td>
										<td class="t2" colspan="3" >
											<textarea rows="5" cols="73"
												name="subMember.sub_reproduceIntroduce">${subMember.sub_reproduceIntroduce }</textarea>
										</td>
									</tr>
									<tr>
										<td align="right" class="title">
											<span>发帖纪录：</span>
										</td>
										<td class="t2" colspan="3" >
											<textarea rows="5" cols="73" name="subMember.sub_forumPosting">${subMember.sub_forumPosting }</textarea>
										</td>
									</tr>
									<tr>
										<td align="right" class="title">
											<span>备注：</span>
										</td>
										<td class="t2" colspan="3" >
											<textarea rows="5" cols="73" name="subMember.sub_remark">${subMember.sub_remark }</textarea>
										</td>
									</tr>
									<tr>
										<td>
											<input type="hidden" name="subMember.sub_id" value=${subMember.sub_id } />
										</td>
										<td>
											<input type="hidden" name="subMember.sub_createDate"
												value=${subMember.sub_createDate } />
										</td>
									</tr>
									 <tr>
                                    <td>
                                      <input type="hidden" name="subMember.subComName" id="subComName"/>
                                    </td>
                                    <td>
                                      <input type="hidden" name="subMember.subCityName" id="subCityName"/>
                                    </td>
                                  </tr>
								</table>
							</div>
							<div class="btn">
								<input type="submit" value="保存" />
								<input type="button" value="返回"
									onclick="javascript :history.back(-1);" />
							</div>
						</form>
					</div>
				</div>
			</div>
		</div>
	</body>
</html>
